/*
	@author: Nicolas Santamaria
	@date  : 16/09/08
	@what  : Socket Client
*/

#ifndef __TCPSOCKETCLIENT_H__
#define __TCPSOCKETCLIENT_H__

#ifdef _DEBUG
#pragma comment(lib, "ACEd.lib");
#else
#pragma comment(lib, "ACE.lib");
#endif

#include <ace/SOCK_Connector.h>
#include <ace/IOStream.h>
#include <ace/basic_types.h>
#include <string>

using namespace std;

namespace Network
{
	class ClientSocket
	{
	public:

		virtual void connect(string p_addr, unsigned short p_port) = 0;

		virtual int send(void* p_buffer, unsigned int p_size) = 0;
	};



	class TCPSocketClient : public ClientSocket
	{
	private:
		ACE_INET_Addr					m_peerAddr;
		ACE_SOCK_Stream					m_stream;
		ACE_SOCK_Connector				m_connector;

	public:

		TCPSocketClient();
		//~TCPSocketClient();
		
		void connect(string p_addr, unsigned short p_port = ACE_DEFAULT_SERVER_PORT);
		int send(void* p_buffer, unsigned int p_size);
	};
};

#endif //__TCPSOCKETCLIENT_H__